package com.gxw.rxjavatest.data;

import com.gxw.rxjavatest.model.bean.ImageResponse;
import com.gxw.rxjavatest.model.bean.LogInSec;
import com.gxw.rxjavatest.model.bean.UpLogin;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Headers;
import retrofit2.http.POST;

/**
 * Created by GXW on 2016/4/7 0007.
 * email:603004002@qq.com
 */
public interface ApiService {
    //通过注解设置请求头
    @Headers({
            "Cache-Control: max-age=640000",
            "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
    })

//    @Multipart//http://my.oschina.net/cnlw/blog/168466?fromerr=aQL9sTI2 讲解Multipart
    @POST("/wcf.svc/app_login.action")
    Call<LogInSec> getInfo(@Body UpLogin upLogin);

    //@Field parameters can only be used with form encoding.
    @FormUrlEncoded
    @POST("/wcf.svc/app_login.action")
    Call<LogInSec> getInfo2(@Field("loginID") String loginID, @Field("password") String password, @Field("deviceType") String deviceType);

    @FormUrlEncoded
    @POST("/wcf.svc/upphoto.action")
    Call<ImageResponse> upImage(@Field("loginID") String loginID, @Field("password") String password, @Field("deviceType") String deviceType, @Field("file") String imgStr);
}
